#include "OQueue.h"

Queue::Queue() :
	m_first(0)
{
}

Queue::~Queue()
{
	if (m_first != 0)
	{
		delete m_first;
	}
}

void Queue::push(T value)
{
	if (m_first == 0)
	{
		m_first	= new Node<T>(value);
	}
	else
	{
		m_first->append(value);
	}
}

void Queue::pop()
{
	if (m_first != 0)
	{
		Node<T> *d	= m_first;
		m_first	= m_first->m_next;
		d->m_next	= 0;
		delete d;
	}
}

bool Queue::has()
{
	return m_first != 0;
}

T Queue::first()
{
	return m_first->m_value;
}
